 <script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
});
</script>
 <?php if(!empty($id)) { ?>
 <form action="<?= $admin_base_url; ?>users/edit/<?=$id;?>/<?php echo $cur_page;?>" method="post" id="users_form">
 <?php } else { ?>
 <form action="<?= $admin_base_url; ?>users/add/<?= $cur_page;?>" method="post" id="users_form">
 <?php } ?>
<table border="0" width="100%" align="center" cellpadding="0" cellspacing="0">

				  <tr>
					<td height="23" colspan="2" class="MainTxt">
				 		<p class="smallHead">Login Details</p>
				 	</td>
				  </tr>
				 <tr>
					<td width="30%" height="25" class="MainTxt"><strong> Username * </strong></td>
					<td><input name="email" type="text" value="<?php echo $user['email']; ?>" class="TxtButton" style="width:300px" id="firstName" size="31" /></td>
				  </tr>
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Password * </strong></td>
					<td>
						<input name="password" type="password" value="<?php echo $user['password'];?>" class="TxtButton" style="width:300px" id="firstName" size="31" />
					</td>
				  </tr>
                  
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Re enter Password * </strong></td>
					<td><input name="conf_password" type="password" value="<?php echo $user['pwd'];?>" class="TxtButton" style="width:300px" id="firstName" size="31" /></td>
				  </tr>
                  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Groups</strong></td>
					<td>
                    <?php
					foreach($group as $g)
					{
						echo "<input type='checkbox' name='group".$g['id']."' ";
						if(!empty($groups))
						foreach($groups as $gs)
						{
							if( $g['id'] == $gs['group_id'])
							echo "checked";
						}
						echo " value='". $g['id']."'/>".$g['name']."  ";
					}
					?>
                <?php /*    <select name="group">
                    <?php
					foreach($group as $g)
					{
						echo "<option>".$g['name']." </option>";
					}
					?>
                    </select>  */ ?>
						
					</td>
				  </tr>
				  <tr>
					<td height="23" colspan="2">
				 	</td>
				  </tr>
				  <tr>
					<td height="23" colspan="2" class="MainTxt">
				 		<p class="smallHead">Personal Details </p>
				 	</td>
				  </tr>
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Name * </strong></td>
					<td><input name="first_name" type="text" value="<?= $user['first_name']; ?>" class="TxtButton" style="width:300px" id="firstName" size="31" /></td>
				  </tr>
				  
				  <tr>
					<td height="25" class="MainTxt"><strong>Address1 </strong></td>
					<td><textarea name="address1" cols="30"  rows="1" class="TxtButton" style="width:300px" id="address"><?php echo !empty($user['address1']) ? $user['address1'] : '';?></textarea></td>
				  </tr>
				  
				  <tr>
					<td height="25" class="MainTxt"><strong>Address2 </strong></td>
					<td><textarea name="address2" cols="30"  rows="1" class="TxtButton" style="width:300px" id="address"><?php echo $user['address2'];?></textarea></td>
				  </tr>
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>City </strong></td>
					<td><input name="city" type="text" value="<?php echo $user['city_id'];?>" class="TxtButton" style="width:300px" id="firstName" size="31" /></td>
				  </tr>
				
				 
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Pin Code  </strong></td>
					<td><input name="pcode" type="text" value="<?php echo $user['pincode'];?>" class="TxtButton" style="width:300px" id="firstName" size="31" /></td>
				  </tr>
				  <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Tel No * </strong></td>
					<td>
						<input name="phone1" type="text" value="<?php echo $user['phone1'];?>" class="TxtButton" style="width:30px" id="firstName" size="31" /> - 
						<input name="phone2" type="text" value="<?php echo $user['phone2'];?>" class="TxtButton" style="width:256px" id="firstName" size="31" />
					</td>
				  </tr>
				   <tr>
					<td width="30%" height="25" class="MainTxt"><strong>Mobile No * </strong></td>
					<td>
						<input name="mobile1" type="text" value="<?php echo $user['mobile1'];?>" class="TxtButton" style="width:30px" id="firstName" size="31" /> - 
						<input name="mobile2" type="text" value="<?php echo $user['mobile2'];?>" class="TxtButton" style="width:256px" id="firstName" size="31" />
					</td>
				  </tr>
				  <tr>
					<td width="30%" height="25" class="MainTxt"></td>
					<td>
					<!--	<input type="checkbox" name="can_communicate" value="1" border="0" checked="checked" /> Send me communication from Cars.com Partners<br /> -->
					<!--	<input type="checkbox" name="can_newsletter" value="1" border="0" checked="checked"/> Send me Cars.com newsletter-->
					</td>
				  </tr>
				  <tr>
					<td height="30">&nbsp;</td>
					<td valign="bottom">
					<div class="buttons">
			    <button type="submit" name="save" class="positive" value="save" >
			        <img src="<?php echo $admin_image_path?>icons/apply.png" alt=""/>
			          <?php if(!empty($id)) { ?>
 							Update User
 							<input type="hidden" name="id" value="<?php echo $id;?>" />
 					  <?php } else { ?>
							Add User
 					  <?php } ?>
 			    </button>
			   <a href="<?= $admin_base_url; ?>church/cancel" class="negative">
			        <img src="<?php echo $admin_image_path?>icons/cross.png" alt=""/>
			        Cancel
			   </a>
			</div>
			</td>
				  </tr>
				  <tr>
					<td colspan="2">&nbsp;</td>
			
				  </tr>
				</table>
 </form>
 <script>
 $(document).ready(function() {
     $("#users_form").RSV({
       onCompleteHandler: frmSubmit,
       errorFieldClass: "errorDesc",
       displayType: "display-html",
       errorHTMLItemBullet: "&#8212; ",
             rules: [
				"required,email,Please enter your email address.",
				/*"valid_email,email,Please enter a valid email address.",
				"required,password,Please enter a password.",
				"same_as,password,conf_password,Please ensure the passwords you enter are the same.",*/
				"required,first_name,Please enter your name.",
				/*"valid_date,dobmm,dobdd,dobyy,any_date,Please enter a valid date of birth."*/
                     
             ]
     });
  // a custom onComplete handler to prevent form submits for the demo
     function frmSubmit()
     {
       return true;
     }

        
});
 </script>